#ifndef REMOTE_SERVER_BASE_BASEDEFINES_H_
#define REMOTE_SERVER_BASE_BASEDEFINES_H_

#include "vzbase/base/basictypes.h"
#include <string>

namespace remote {

const int   FLAG_NORMAL_MESSAGE     = 0;
const int   FLAG_PING_MESSAGE       = 1;
const int   FLAG_REGISTER_MESSAGE   = 2;

const char  PING_MESSAGE[] = "P";

const char JSON_TYPE[] = "type";
const char JSON_STATE[] = "state";
const char JSON_ID[] = "id";
const char JSON_TO[] = "to";
const char JSON_FROM[] = "from";
const char JSON_BODY[] = "body";

const char JSON_PASSWORD[] = "password";
const char JSON_USERNAME[] = "username";

const char JSON_TYPE_REGISTER[] = "register";
const char JSON_TYPE_GET_ONLINE_SESSIONS[] = "get_online";

const char DEFAULT_SERVER_NAME[] = "server@server.com";
const char DEFAULT_CLIENT_NAME[] = "client@client.com";

const char   DEFAULT_SERVER_ADDR[] = "0.0.0.0";
const uint16 DEFAULT_SERVER_PORT   = 4121;


const uint32 DEFAULT_ID_SIZE = 8;

const uint32 STATE_REQUESTION_STATE = 0;

// Client side error
const uint32 CLIENT_SESSION_ERROR_CODE_SERVER_UNKOWN = 100;
const uint32 CLIENT_SESSION_ERROR_CODE_REGISTER_ERROR = 101;

// Server side error and state
const uint32 STATE_CONTROL_REGISTER_SUCCEED = 200;
const uint32 STATE_CONTROL_REGISTER_FAILURE = 201;

// Tunnel side error and state
const uint32 STATE_SERVER_SUCCEED = 300;
const uint32 STATE_SERVER_SESSION_NOT_FOUND = 301;
const uint32 STATE_SERVER_DISCONNECTED      = 302;

const uint32 STATE_TUNNEL_CLIENT_SUCCEED = 400;
const uint32 STATE_TUNNEL_CLIENT_FAILURE = 401;
struct RemoteServerSettings {
  std::string control_addr_;
  uint16      control_port_;
};

// For server
const char JSON_TYPE_SERVER_GET_ONLINE_SESSION[] = "get_online_session";
const char JSON_TYPE_CREATE_TUNNEL_PROXY[] = "create_tunnel_proxy";
const char JSON_BODY_SERVER_ADDR[] = "server_addr";
const char JSON_BODY_SERVER_PORT[] = "server_port";
const char JSON_BODY_TUNELL_ADDR[] = "tunnel_addr";
const char JSON_BODY_TUNNEL_PORT[] = "tunnel_port";
const char JSON_BODY_TOKEN_KEY[]   = "token_key";

const uint32 TUNNEL_ERROR_CODE_FAILURE_CONNECT_SERVER   = 100;
const uint32 TUNNEL_ERROR_CODE_FAILURE_CONNECT_SESSION  = 200;
const uint32 TUNNEL_ERROR_CODE_FAILURE_CONNECT_DES      = 300;
const uint32 TUNNEL_ERROR_CODE_FAILURE_CONNECT_TUNNEL   = 400;
const uint32 TUNNEL_ERROR_CODE_PROXY_CONNECT_SERVER     = 401;
const uint32 TUNNEL_CREATE_SUCCEED                      = 402;
}

#endif  // REMOTE_SERVER_BASE_BASEDEFINES_H_
